Page({
    data: {
        packageSizes: ['小', '中', '大'],
        packageSizeIndex: 0,
        imageUrl: '',
        destination: '',
        fee: '',
        remarks: ''
    },
    uploadImage: function() {
        const that = this;
        wx.chooseImage({
            count: 1,
            sizeType: ['compressed'],
            sourceType: ['album', 'camera'],
            success(res) {
                const tempFilePaths = res.tempFilePaths;
                that.setData({
                    imageUrl: tempFilePaths[0]
                });
            }
        });
    },
    bindDestinationInput: function(e) {
        this.setData({
            destination: e.detail.value
        });
    },
    bindFeeInput: function(e) {
        this.setData({
            fee: e.detail.value
        });
    },
    bindRemarksInput: function(e) {
        this.setData({
            remarks: e.detail.value
        });
    },
    placeOrder: function() {
        if (!this.data.destination || !this.data.fee) {
            wx.showToast({
                title: '请填写送到哪和跑腿费！',
                icon: 'none'
            });
            return;
        }
        wx.showToast({
            title: '下单成功！',
            icon: 'success'
        });
    }
});